package com.truthbean.jeetb.api.jaxrs;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by TruthBean on 2016-10-14 16:27.
 */
@Path("/wxdemo/cascade")
public class CityCascade implements Serializable {
    @GET
    @Path("/city")
    @Produces("application/json")
    public List<String> getCities(@QueryParam("country") String country){
        List<String> list = new ArrayList<>();
        if("中国".equals(country)){
            list.add("北京");
            list.add("上海");
            list.add("深圳");
            list.add("广州");
            list.add("杭州");
            list.add("青岛");
        }
        return list;
    }

    @GET
    @Path("/country")
    @Produces(MediaType.APPLICATION_JSON)
    public List<String> getCountries(){
        List<String> list = new ArrayList<>();
        list.add("中国");
        list.add("美国");
        return list;
    }
}
